package com.juku2024.juku.model

import android.os.Parcel
import android.os.Parcelable

class HomeAdapterItem() : Parcelable {
    var id: Long? = null
    var adapterType: Int = 0
    // 每个数据集合的开始位置
    var notifyPosStart: Int = 0
    // 标题
    var name: String? = null
    // 右边的副标ß题
    var sub_name: String? = null
    // 更多
    var more: String? = null
    // 更新
    var refresh: String? = null

    var pic: String? = null
    // 清晰度
    var quality: String? = null
    // grid的布局 左：0，右：1
    var direction: Int? = null

    var template: Int? = null
    // 图片右下角内容 只提供一个字段
    var content: String? = null
    var isMovie: Boolean? = false
    var contentIndex: Int? = null
    var url: String? = null
    var version: Int = 0
    var isNewEpisode: Boolean? = false
    var carousel: ArrayList<CarouselModel>? = null


    // 追剧片单
    var watching: ArrayList<CommonModel>? = null
    constructor(parcel: Parcel) : this() {
        id = parcel.readLong()
        adapterType = parcel.readInt()
        notifyPosStart = parcel.readInt()
        name = parcel.readString()
        sub_name = parcel.readString()
        more = parcel.readString()
        refresh = parcel.readString()
        pic = parcel.readString()
        quality = parcel.readString()
        direction = parcel.readValue(Int::class.java.classLoader) as? Int
        template = parcel.readValue(Int::class.java.classLoader) as? Int
        content = parcel.readString()
        isMovie = parcel.readValue(Boolean::class.java.classLoader) as? Boolean
        contentIndex = parcel.readValue(Int::class.java.classLoader) as? Int
        url = parcel.readString()
        version = parcel.readInt()
        isNewEpisode = parcel.readValue(Boolean::class.java.classLoader) as? Boolean
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeValue(id)
        parcel.writeInt(adapterType)
        parcel.writeInt(notifyPosStart)
        parcel.writeString(name)
        parcel.writeString(sub_name)
        parcel.writeString(more)
        parcel.writeString(refresh)
        parcel.writeString(pic)
        parcel.writeString(quality)
        parcel.writeValue(direction)
        parcel.writeValue(template)
        parcel.writeString(content)
        parcel.writeValue(isMovie)
        parcel.writeValue(contentIndex)
        parcel.writeString(url)
        parcel.writeInt(version)
        parcel.writeValue(isNewEpisode)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<HomeAdapterItem> {
        override fun createFromParcel(parcel: Parcel): HomeAdapterItem {
            return HomeAdapterItem(parcel)
        }

        override fun newArray(size: Int): Array<HomeAdapterItem?> {
            return arrayOfNulls(size)
        }
    }

}